﻿<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="Personnel.aspx.cs" Inherits="Catering.Catering_Page.system.Personnel" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../../../Style/head.css" />
    <link rel="stylesheet" type="text/css" href="../../../Style/center.css" />
    <link href="../../../Style/zhezhao.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/zhezhao.js" type="text/javascript"></script>
    <link href="../../../Style/tinybox_style.css" rel="stylesheet" type="text/css" />
    <script src="../../../Style/xxk.js" type="text/javascript"></script>
    <link href="../../Style/sysData.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="../../Scripts/My97DatePicker/WdatePicker.js"></script>
    <style type="text/css">
        .Create_Recipe
        {
            margin-top: 0;
        }
        .Create_Recipe
        {
            border: 1px solid #159aec;
            border-top: none;
            width: 993px;
            padding-left:5px;
            min-height:400px;
        }
        .page{width:340px; margin:0px auto; line-height:30px;}
        .page input{ vertical-align:middle;}
        .table_td_120 td{padding:5px 0px;}
    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#Drop_UOperationArea").change(function () {
                var cid = $(this).val();
                $.ajax({
                    type: "Post",
                    url: "Personnel.aspx/GetClassInfo",
                    data: "{'cid':'" + cid + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        $("#Drop_UClassInfo").html(data.d);
                        $("#HidClassID").val($("#Drop_UClassInfo").val());
                    }
                });
            });

            $("#Drop_UClassInfo").change(function () {
                $("#HidClassID").val($(this).val());
            });
        });


        //显示添加
        function Add() {
            $("#btnEdit").hide();
            $("#btnAdd").show();
            $("#div_span_title").text("添加");
            divshow("main", "bg");
        }

        //显示修改
        function Edit(cid) {
            $("#HidID").val(cid);
            Personnel.GetPersonnel(cid, LoadPersonnel);
        }

        function LoadPersonnel(data) {
            if (data.value[0] == "OK") {                

                $("#txt_UName").val(data.value[1]);
                $("#txt_Sex").val(data.value[2]);
                $("#txt_Old").val(data.value[3]);
                $("#txt_No").val(data.value[4]);
                $("#txt_Placeoforigin").val(data.value[5]);

                $("#txt_Education").val(data.value[6]);
                $("#txt_Professional").val(data.value[7]);
                $("#txt_Title").val(data.value[8]);
                $("#txt_Politicalaffiliation").val(data.value[9]);
                $("#txt_QQ").val(data.value[10]);

                $("#Drop_ServiceUnit").val(data.value[11]);
                $("#txt_Tel").val(data.value[12]);
                $("#txt_Email").val(data.value[13]);
                $("#txt_ADD").val(data.value[14]);
                $("#Drop_PID").val(data.value[15]);
                $("#Drop_IsWorking").val(data.value[16]);
                $("#txt_back").val(data.value[17]);
                $("#txt_EntryTime").val(data.value[18]);
                $("#txt_TrackNum").val(data.value[19]);
                $("#txt_HealthyNo").val(data.value[20]);
                $("#txt_EPreventionNo").val(data.value[21]);

                $("#btnEdit").show();
                $("#btnAdd").hide();
                $("#div_span_title").text("修改");
                divshow("main", "bg");
            }
        }

        //显示调整班组
        function EditClass(cid) {
            $("#HidID").val(cid);
            $.ajax({
                type: "Post",
                url: "Personnel.aspx/GetClassInfoByCID",
                data: "{'cid':'" + cid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#Drop_UOperationArea").val(data.d[0]);
                    $("#Drop_UClassInfo").html(data.d[1]);
                    $("#Drop_UClassInfo").val(data.d[2]);
                    $("#HidClassID").val(data.d[2]);
                    divshow("div_TG", "bg");
                }
            });
        }

        function CheckPersonel() {
            var age = $("#txt_Old").val();
            var txt_No = $("#txt_No").val();
            if (txt_No == "") {
                alert("请输入正确的身份证号！");
                return false;
            }

            if(age==null || age=="") 
            {
                alert("请选择出生日期！");
                return false;
            }
            return true;
        }


        function ValidateIdCard(sId) {
            var aCity = { 11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江 ", 31: "上海", 32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北 ", 43: "湖南", 44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏 ", 61: "陕西", 62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门", 91: "国外 " }
            var iSum = 0;
            var info = "";
            //if (!/^d{17}(d|x)$/i.test(sId)) return 'Error:非法证号';
            sId = sId.replace(/x$/i, "a");
            if (aCity[parseInt(sId.substr(0, 2))] == null) return false; //"Error:非法地区";
            sBirthday = sId.substr(6, 4) + "-" + Number(sId.substr(10, 2)) + "-" + Number(sId.substr(12, 2));
            var d = new Date(sBirthday.replace(/-/g, "/"))
            if (sBirthday != (d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate())) return false; // "Error:非法生日";
            for (var i = 17; i >= 0; i--) iSum += (Math.pow(2, i) % 11) * parseInt(sId.charAt(17 - i), 11)
            if (iSum % 11 != 1) return false; // "Error:非法证号";
            return true; //aCity[parseInt(sId.substr(0, 2))] + "," + sBirthday + "," + (sId.substr(16, 1) % 2 ? "男" : "女")
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:HiddenField ID="HidID" runat="server" />
    <asp:HiddenField ID="HidClassID" runat="server" />
    <div class="xxk_button">
    </div>
    <div class="Center_Content">
        <div class="Create_Recipe">
            <div class="btn_list">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="75" align="right">作业公司：</td>
                        <td width="110"><asp:DropDownList ID="Drop_OperationArea"  runat="server" Width="100" AutoPostBack="true" CssClass="select_input_bg" 
                                onselectedindexchanged="Drop_OperationArea_SelectedIndexChanged"></asp:DropDownList>
                        </td>
                        <td width="45" align="right">班组：</td>
                        <td width="110"><asp:DropDownList ID="Drop_ClassInfo" runat="server" Width="100" CssClass="select_input_bg"></asp:DropDownList>
                        </td>
                        <td width="45" align="right">姓名：</td>
                        <td width="110"><asp:TextBox ID="txt_Name" runat="server" Width="100" CssClass="input_bg"></asp:TextBox></td>
                        <td width="75" align="right">所属单位：</td>
                        <td width="110">
                            <asp:DropDownList ID="Drop_ServiceUnitSearch" runat="server"></asp:DropDownList>
                        </td>
                        <td width="100">
                            <asp:Button ID="Btn_Search" runat="server" Text="查询" CssClass="input_btn_a"  onclick="Btn_Search_Click" />
                        </td>
                        <td>&nbsp;</td>
                         <%if (Catering.Toolss.IsVerification(Session["RoleID"].ToString(), "Personnel.aspx", "添加"))
                           { %>
                        <td width="100" align="right">
                            <input type="button" value="添加" onclick="Add()" class="input_btn_a" />
                        </td>
                        <%} %>
                        <td width="10"></td>
                    </tr>
                </table>
            </div>
            <div class="data_css" style="border:0px; height:auto;">
                <table width="100%" border="1" cellpadding="0" cellspacing="0">
                    <thead>
                        <tr>
                            <th>调岗</th>
                            <th>编辑</th>
                            <th>删除</th>
                            <th>姓名</th>
                            <th>性别</th>
                            <th>出生日期</th>
                            <th>身份证号</th>
                            <th>籍贯</th>
                            <th>学历</th>
                            <th>QQ</th>
                            <th>电话</th>
                            <th>邮箱</th>
                            <th>班组</th>
                            <th>所属单位</th>
                            <th>岗位</th>
                        </tr>
                    </thead>
                    <tbody>
                        <asp:Repeater ID="Rep_Personnel" runat="server" OnItemCommand="Rep_ItemCommand">
                            <ItemTemplate>
                                <tr>
                                    <td>
                                        <%if (Catering.Toolss.IsVerification(Session["RoleID"].ToString(), "Personnel.aspx", "人员调动")) { %>
                                        <input type="button" value="人员调动" onclick="EditClass('<%#Eval("id")%>')" />
                                        <%} %>&nbsp;
                                    </td>
                                    <td>
                                    <%if (Catering.Toolss.IsVerification(Session["RoleID"].ToString(), "Personnel.aspx", "编辑"))
                                      { %>
                                        <img src="../../Images/file.gif" onclick="Edit('<%#Eval("id")%>')" style="cursor: pointer;" />
                                        <%} %>
                                    </td>
                                    <td>
                                    <%if (Catering.Toolss.IsVerification(Session["RoleID"].ToString(), "Personnel.aspx", "删除"))
                                      { %>
                                        <asp:ImageButton ID="img_btn" runat="server" ImageUrl="../../Images/trash.gif" OnClientClick="return confirm('确认删除？');"
                                            CommandArgument='<%#Eval("id")%>' CommandName="del" />
                                            <%} %>
                                    </td>
                                    <td><%#Eval("Name")%></td>
                                    <td><%#Eval("Sex")%>&nbsp;</td>
                                    <td><%# (!(Eval("Old") is DBNull) && Eval("Old") != null && Eval("Old").ToString() != "" && Convert.ToDateTime(Eval("Old")).ToShortDateString() != "1900/1/1")?(Convert.ToDateTime(Eval("Old")).ToShortDateString()): ""%> 
                                    </td>
                                    <td><%#Eval("No")%>&nbsp;</td>
                                    <td><%#Eval("Placeoforigin")%>&nbsp;</td>
                                    <td><%#Eval("Education") %>&nbsp;</td>
                                    <td><%#Eval("QQ")%>&nbsp;</td>
                                    <td><%#Eval("Tel")%>&nbsp;</td>
                                    <td><%#Eval("Email")%>&nbsp;</td>
                                    <td><%#this.GetClassName(Eval("ClassID") == null ? "" : Eval("ClassID").ToString())%></td>
                                    <td><%#GetServiceUnitName(Eval("ServiceUnitID").ToString())%>&nbsp;</td>
                                    <td><%#GetBranchPostName(Eval("PID").ToString())%></td>
                                </tr>
                            </ItemTemplate>
                        </asp:Repeater>
                    </tbody>
                </table>
            </div>
            <div class="page">
                <webdiyer:AspNetPager ID="AspNetPager1" runat="server" PageSize="20" OnPageChanging="AspNetPager1_PageChanging"
                    FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" 
                    ShowPageIndex="true" NumericButtonCount="6" SubmitButtonText="确定">
                </webdiyer:AspNetPager>
            </div>
            <!--弹出层-->
            <div id="bg" class="bg">
            </div>
            <div id="main" class="center_div" style=" position:absolute;width:900px; height: 300px; padding: 0px;left:10%;top:20%;
                ">
                <div class="div_0207" style="width: 880px; margin: 5px 0px 0px 10px;">
                    <h1>
                        <img src="../../Images/cp_h1_03.gif" /><span id="div_span_title">添加</span>人员</h1>
                    <table width="100%" class="table_td_120">
                        <tr>
                            <td>
                                姓名：
                            </td>
                            <td>
                                <asp:TextBox ID="txt_UName" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                            <td>性别：</td>
                            <td>
                                <asp:DropDownList ID="Drop_Sex" runat="server" CssClass="select_input_bg"></asp:DropDownList>
                            </td>
                            <td><span style="color:Red;">*</span>出生日期：</td>
                            <td>
                                <asp:TextBox ID="txt_Old" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                            <td>身份证号：</td>
                            <td>
                                <asp:TextBox ID="txt_No" runat="server" CssClass="input_bg"></asp:TextBox><span style="color:Red;">*</span>
                            </td>
                        </tr>
                        <tr>
                            <td>籍贯：</td>
                            <td>
                                <asp:TextBox ID="txt_Placeoforigin" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                            <td>学历：</td>
                            <td>
                                <asp:TextBox ID="txt_Education" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                            <td>专业：</td>
                            <td>
                                <asp:TextBox ID="txt_Professional" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                            <td>职称：</td>
                            <td>
                                <asp:TextBox ID="txt_Title" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>政治面貌：</td>
                            <td>
                                <asp:TextBox ID="txt_Politicalaffiliation" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                            <td>QQ：</td>
                            <td>
                                <asp:TextBox ID="txt_QQ" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                            <td>所属单位：</td>
                            <td>
                                <asp:DropDownList ID="Drop_ServiceUnit" runat="server" CssClass="select_input_bg"></asp:DropDownList>
                            </td>
                            <td>手机号码：</td>
                            <td>
                                <asp:TextBox ID="txt_Tel" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td>邮箱：</td>
                            <td>
                                <asp:TextBox ID="txt_Email" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                            <td>地址：</td>
                            <td>
                                <asp:TextBox ID="txt_ADD" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                            <td>岗位：</td>
                            <td>
                                <asp:DropDownList ID="Drop_PID" runat="server" CssClass="select_input_bg"></asp:DropDownList>
                            </td>
                            <td style="display:none;">是否在岗：</td>
                            <td style="display:none;">
                                <asp:DropDownList ID="Drop_IsWorking" runat="server" CssClass="select_input_bg">
                                    <asp:ListItem Text="是" Value="1"  Selected="True"></asp:ListItem>
                                    <asp:ListItem Text="否" Value="0"></asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                入职时间：
                            </td>
                            <td>
                                <asp:TextBox ID="txt_EntryTime" runat="server" CssClass="input_bg" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"></asp:TextBox>
                            </td>
                            <td>跟踪卡号：</td>
                            <td>
                               <asp:TextBox ID="txt_TrackNum" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                            <td>健康证号：</td>
                            <td>
                                <asp:TextBox ID="txt_HealthyNo" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                            <td>防疫证号：</td>
                            <td>
                                <asp:TextBox ID="txt_EPreventionNo" runat="server" CssClass="input_bg"></asp:TextBox>
                            </td>
                        </tr>
                        
                        <tr>
                            <td>
                                备注：
                            </td>
                            <td colspan="7">
                                <asp:TextBox ID="txt_back" runat="server" TextMode="MultiLine" style="width:98%;height:40px;" CssClass="input_bg"></asp:TextBox>
                            </td>
                        </tr>
                    </table>
                    <table width="100%">
                        <tr>
                            <td align="right">
                                <asp:Button ID="btnAdd" runat="server" Text="提交" CssClass="input_btn_a" onclick="btnAdd_Click"  OnClientClick="return CheckPersonel()"  />
                                <asp:Button ID="btnEdit" runat="server" Text="提交" CssClass="input_btn_a" onclick="btnEdit_Click" OnClientClick="return CheckPersonel()"  />
                            </td>
                            <td>
                                <input type="button" id="but_Close" onclick='divhidel("main","bg")' class="input_btn_a"
                                    value="关闭" />
                            </td>
                        </tr>
                    </table>
                </div>
            </div>

            <div id="div_TG" class="center_div" style="width:500px; height: 130px; padding: 0px;left:50%;
                margin-top: -100px;">
                <div class="div_0207" style="width: 480px; margin: 5px 0px 0px 10px;">
                    <h1><img src="../../Images/cp_h1_03.gif" />人员调整</h1>
                    <table width="100%" class="table_td_120">
                        <tr>
                            <td>作业区：</td>
                            <td>
                                <asp:DropDownList ID="Drop_UOperationArea" runat="server" CssClass="select_input_bg"></asp:DropDownList>
                            </td>
                            <td>班组：</td>
                            <td>
                                <asp:DropDownList ID="Drop_UClassInfo" runat="server" CssClass="select_input_bg"></asp:DropDownList>
                            </td>
                        </tr>
                    </table>
                    <table width="100%">
                        <tr>
                            <td align="right">
                                <asp:Button ID="btn_TG" runat="server" Text="提交" CssClass="input_btn_a" onclick="btn_TG_Click"/>
                            </td>
                            <td>
                                <input type="button" id="Button3" onclick='divhidel("div_TG","bg")' class="input_btn_a"
                                    value="关闭" />
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="footer">
        <strong>中海油能源发展配餐服务公司渤海自营油田作业公司&nbsp;&nbsp;版权所有@CopyRight 2012</strong><span>技术支持：北京天择嘉业科技有限公司</span>
    </div>
    </form>
</body>
</html>
